/**
 * ResourceCompetency entity.Getters & setters.
 */
package com.xoomworks.rsfr.model;

import java.io.Serializable;
import java.util.Date;

/**
 * The persistent class for the ResourceCompetencies database table.
 * @author andrea.ghisa
 */
public class ResourceCompetency extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    private Date createdOn;

    private Date modifiedOn;

    private int yearsOfExperience;

    // bi-directional many-to-one association to Resource
    private Resource resource;

    // uni-directional many-to-one association to User
    private User createdBy;

    // uni-directional many-to-one association to User
    private User modifiedBy;

    // uni-directional many-to-one association to Skill
    private Skill skill;

    // uni-directional many-to-one association to Expertiselevel
    private ExpertiseLevel expertiseLevel;

    /**
     * Constructor with no fields.
     */
    public ResourceCompetency() {
    }

    /**
     *Constructor with the specified parameters.
     * @param createdOn
     *            Date Represents the date when the resource competency was
     *            created.
     * @param yearsOfExperience
     *            Int Represents the years of experience that resource have.
     * @param resource
     *            Resource Represents the resource.
     * @param createdBy
     *            User Represents the name of user who created the resource
     *            competency.
     * @param skill
     *            Skill The resource's required skill.
     * @param expertiseLevel ExpertiseLevel Represents the expersise level of a resource
     */
    public ResourceCompetency(final Date createdOn, final int yearsOfExperience, final Resource resource,
            final User createdBy, final Skill skill, final ExpertiseLevel expertiseLevel) {
        super();
        this.createdOn = createdOn;
        this.yearsOfExperience = yearsOfExperience;
        this.resource = resource;
        this.createdBy = createdBy;
        this.skill = skill;
        this.expertiseLevel = expertiseLevel;
    }

    /**
     * Gets the created on date.
     * @return createdOn
     */
    public Date getCreatedOn() {
        return this.createdOn;
    }

    /**
     * Sets the date when resourceCompetency was created.
     * @param createdOn Date Represents the date when resourceCompetency was created.
     */
    public void setCreatedOn(final Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     *Gets the date when resourceCompetency was modified.
     * @return modifiedOn Date Represents the date when resourceCompetency was modified.
     */
    public Date getModifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Sets the date when resourceCompetency was modified.
     * @param modifiedOn Which is used to set ModifiedOn.
     */
    public void setModifiedOn(final Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    /**
     * Gets the years of experience for each resource.
     * @return yearsOfExperience Int Represents years of experience for each resource.
     */
    public int getYearsOfExperience() {
        return this.yearsOfExperience;
    }

    /**
     * Sets the years of experience for each resource.
     * @param yearsOfExperience Int Which is used to set yearsOfExperience.
     */
    public void setYearsOfExperience(final int yearsOfExperience) {
        this.yearsOfExperience = yearsOfExperience;
    }

    /**
     * Gets the resource.
     * @return resource Resource.
     */
    public Resource getResource() {
        return this.resource;
    }

    /**
     * Sets the resource.
     * @param resource Resource.
     */
    public void setResource(final Resource resource) {
        this.resource = resource;
    }

    /**
     * Gets the user who created resourceCompetency.
     * @return createdBy User Represents the user who created resourceCompetency.
     */
    public User getCreatedBy() {
        return this.createdBy;
    }

    /**
     *Sets the user who created resourceCompetency.
     * @param createdBy User Which is used to set createdBy.
     */
    public void setCreatedBy(final User createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets the user who modified the resourceCompetency.
     * @return modifiedBy
     */
    public User getModifiedBy() {
        return this.modifiedBy;
    }

    /**
     * Sets the user who modified the resourceCompetency.
     * @param modifiedBy User Which is used to set modifiedBy.
     */
    public void setModifiedBy(final User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    /**
     * Gets the skill of resource.
     * @return skill Skill Represents the skill of resource.
     */
    public Skill getSkill() {
        return this.skill;
    }

    /**
     * Sets the skill of resource.
     * @param skill Skill Which is use to set skill.
     */
    public void setSkill(final Skill skill) {
        this.skill = skill;
    }

    /**
     * Gets the expertise level.
     * @return expertiseLevel ExpertiseLevel Represents the expertise level of the resource.
     */
    public ExpertiseLevel getExpertiseLevel() {
        return this.expertiseLevel;
    }

    /**
     * Sets the expertise level.
     * @param expertiseLevel ExpertiseLevel Which is used to set the expertiseLevel.
     */
    public void setExpertiseLevel(final ExpertiseLevel expertiseLevel) {
        this.expertiseLevel = expertiseLevel;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result) + ((expertiseLevel == null) ? 0 : expertiseLevel.hashCode());
        result = (prime * result) + ((skill == null) ? 0 : skill.hashCode());
        result = (prime * result) + yearsOfExperience;
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        ResourceCompetency other = (ResourceCompetency) obj;
        if (expertiseLevel == null) {
            if (other.expertiseLevel != null) {
                return false;
            }
        } else if (!expertiseLevel.equals(other.expertiseLevel)) {
            return false;
        }
        if (skill == null) {
            if (other.skill != null) {
                return false;
            }
        } else if (!skill.equals(other.skill)) {
            return false;
        }
        if (yearsOfExperience != other.yearsOfExperience) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ResourceCompetency [createdOn=" + createdOn + ", modifiedOn=" + modifiedOn
                + ", yearsOfExperience=" + yearsOfExperience + ", resource=" + resource
                + ", createdBy=" + createdBy + ", modifiedBy=" + modifiedBy + ", skill=" + skill
                + ", expertiseLevel=" + expertiseLevel + "]";
    }

}
